{% load string %}
{% load i18n %} 
{% load ytutil %}

<div class="post">
  <div class="BlogTitle">
    <a href="{% url ytcommunity.blog.view.blog.display post.key.id %}"><h2 class="title">{{ post.title|escape }}</h2></a>
  </div>

  <div class="BlogTag">
  {% if post.tags %}
	  {% trans 'tags' %}: 
	  {% for tag in post.tags %}
 	    <a href="{% url ytcommunity.blog.view.blog.all %}?tag={{ tag|encode|urlencode }}">{{ tag|escape }}</a>, 
      {% endfor %}
  {% endif %}
  </div>

  <div class="BlogTime">
  {{ post.author.get_name }} {{ post.date|timedelta|date:"Y-m-d H:i" }}
  {% if ytblog_use_promotion %}
  {% trans 'Popular' %}: {{ post.points }}
  {% endif %}
  </div>
  
  <div class="BlogText">
  {% if posts %}  
  {{ post.content|removetags:"script"|truncatewords_html:20|safe }}
  {% else %}
  {{ post.content|removetags:"script"|safe }}
  {% endif %}
  </div>
  
  {% if not posts %}
	  <div class="BlogOperation">
	  
		  {% if post.auth.edit %}
		  <a class="BlogOperation" href="{% url ytcommunity.blog.view.blog.edit post.key.id %}">{% trans 'Edit' %}</a>
		  {% endif %}
	
		  {% if post.auth.delete %}
		  <div class="BlogButton" 
		    onclick="$.post('{% url ytcommunity.blog.view.blog.delete post.key.id %}', function(data){document.location.replace('{% url ytcommunity.blog.view.blog.list %}');});">
		    <span>{% trans 'Delete' %}</span>
		  </div>
		  {% endif %}
	  
		  {% if post.auth.add and ytblog_use_promotion %}
		  <div class="BlogButton" 
		    onclick="$.post('{% url ytcommunity.blog.view.blog.promote post.key.id %}', function(data){document.location.reload(true);});">
		    <span>{% trans 'Promote' %}</span>
		  </div>
		  {% endif %}
	  
	  </div>
	  
	  {% for plugin in plugins_post_bottom %}
	  {% include plugin.config.view_path %}
	  {% endfor %}
  
  {% endif %}

</div>
